﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using CoreModel = PlayerScannerCore.Model;
using Mvvm;
using PlayerScannerCore.Model;

namespace PlayerScannerCore.ViewModel
{
    public class MagViewModel : ItemViewModel, IMag
    {
        private int _iq;
        private int _sync;
        private int _defLevel;
        private int _powLevel;
        private int _dexLevel;
        private int _mstLevel;
        private int _nextDef;
        private int _nextPow;
        private int _nextDex;
        private int _nextMst;
        private int _level;
        private string _leftPhotonBlast;
        private string _centerPhotonBlast;
        private string _rightPhotonBlast;

        internal MagViewModel()
        {
            ItemType = ItemType.Mag;
        }

        internal override void Update(IItem item)
        {
            var mag = (IMag)item;

            Iq = mag.Iq;
            Sync = mag.Sync;
            DefLevel = mag.DefLevel;
            PowLevel = mag.PowLevel;
            DexLevel = mag.DexLevel;
            MstLevel = mag.MstLevel;
            Level = mag.Level;
            LeftPhotonBlast = mag.LeftPhotonBlast;
            CenterPhotonBlast = mag.CenterPhotonBlast;
            RightPhotonBlast = mag.RightPhotonBlast;
            NextDef = mag.NextDef;
            NextPow = mag.NextPow;
            NextDex = mag.NextDex;
            NextMst = mag.NextMst;

            base.Update(mag);
        }

        public int Iq
        {
            get { return _iq; }
            set
            {
                if (_iq != value)
                {
                    _iq = value;
                    OnPropertyChanged("Iq");
                }
            }
        }

        public int Sync
        {
            get { return _sync; }
            set
            {
                if (_sync != value)
                {
                    _sync = value;
                    OnPropertyChanged("Sync");
                }
            }
        }

        public int DefLevel
        {
            get { return _defLevel; }
            set
            {
                if (_defLevel != value)
                {
                    _defLevel = value;
                    OnPropertyChanged("DefLevel");
                }
            }
        }

        public int PowLevel
        {
            get { return _powLevel; }
            set
            {
                if (_powLevel != value)
                {
                    _powLevel = value;
                    OnPropertyChanged("PowLevel");
                }
            }
        }

        public int DexLevel
        {
            get { return _dexLevel; }
            set
            {
                if (_dexLevel != value)
                {
                    _dexLevel = value;
                    OnPropertyChanged("DexLevel");
                }
            }
        }

        public int MstLevel
        {
            get { return _mstLevel; }
            set
            {
                if (_mstLevel != value)
                {
                    _mstLevel = value;
                    OnPropertyChanged("MstLevel");
                }
            }
        }

        public int Level
        {
            get { return _level; }
            set
            {
                if (_level != value)
                {
                    _level = value;
                    OnPropertyChanged("Level");
                }
            }
        }

        public int NextDef
        {
            get { return _nextDef; }
            set
            {
                if (_nextDef != value)
                {
                    _nextDef = value;
                    OnPropertyChanged("NextDef");
                }
            }
        }

        public int NextPow
        {
            get { return _nextPow; }
            set
            {
                if (_nextPow != value)
                {
                    _nextPow = value;
                    OnPropertyChanged("NextPow");
                }
            }
        }

        public int NextDex
        {
            get { return _nextDex; }
            set
            {
                if (_nextDex != value)
                {
                    _nextDex = value;
                    OnPropertyChanged("NextDex");
                }
            }
        }

        public int NextMst
        {
            get { return _nextMst; }
            set
            {
                if (_nextMst != value)
                {
                    _nextMst = value;
                    OnPropertyChanged("NextMst");
                }
            }
        }

        public string LeftPhotonBlast
        {
            get { return _leftPhotonBlast; }
            set
            {
                if (_leftPhotonBlast != value)
                {
                    _leftPhotonBlast = value;
                    OnPropertyChanged("LeftPhotonBlast");
                }
            }
        }

        public string CenterPhotonBlast
        {
            get { return _centerPhotonBlast; }
            set
            {
                if (_centerPhotonBlast != value)
                {
                    _centerPhotonBlast = value;
                    OnPropertyChanged("CenterPhotonBlast");
                }
            }
        }

        public string RightPhotonBlast
        {
            get { return _rightPhotonBlast; }
            set
            {
                if (_rightPhotonBlast != value)
                {
                    _rightPhotonBlast = value;
                    OnPropertyChanged("RightPhotonBlast");
                }
            }
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 23;
                hash = hash * 29 + Iq.GetHashCode();
                hash = hash * 29 + Sync.GetHashCode();
                hash = hash * 29 + DefLevel.GetHashCode();
                hash = hash * 29 + PowLevel.GetHashCode();
                hash = hash * 29 + DexLevel.GetHashCode();
                hash = hash * 29 + MstLevel.GetHashCode();
                hash = hash * 29 + Level.GetHashCode();
                hash = hash * 29 + LeftPhotonBlast.GetHashCode();
                hash = hash * 29 + CenterPhotonBlast.GetHashCode();
                hash = hash * 29 + RightPhotonBlast.GetHashCode();
                hash = hash * 29 + NextDef.GetHashCode();
                hash = hash * 29 + NextPow.GetHashCode();
                hash = hash * 29 + NextDex.GetHashCode();
                hash = hash * 29 + NextMst.GetHashCode();
                return hash * 29 + base.GetHashCode();
            }
        }

        public override bool Equals(object obj)
        {
            var objAsSpecific = obj as MagViewModel;

            if (objAsSpecific == null)
                return false;

            if (ReferenceEquals(this, obj))
                return true;

            return objAsSpecific.Iq == Iq
                && objAsSpecific.Sync == Sync
                && objAsSpecific.DefLevel == DefLevel
                && objAsSpecific.PowLevel == PowLevel
                && objAsSpecific.DexLevel == DexLevel
                && objAsSpecific.MstLevel == MstLevel
                && objAsSpecific.Level == Level
                && objAsSpecific.LeftPhotonBlast == LeftPhotonBlast
                && objAsSpecific.CenterPhotonBlast == CenterPhotonBlast
                && objAsSpecific.RightPhotonBlast == RightPhotonBlast
                && objAsSpecific.NextDef == NextDef
                && objAsSpecific.NextPow == NextPow
                && objAsSpecific.NextDex == NextDex
                && objAsSpecific.NextMst == NextMst
                && base.Equals(obj);
        }
    }
}
